import { http } from "@/utils/http";
import type { AxiosResultDefault, SelectDataType } from "./type";

type ResultTable = {
  total?: number;
  data?: Array<any>;
};

// 根据typeCode和itemValue查询子项
export const queryChildByTypeCodeAndItemValue = (data?: object) => {
  return http.request<ResultTable>("post", `/account/api/v1/publish/dictItem/queryChildByTypeCodeAndItemValue`, {
    data
  });
};
// 根据typecode查询字典
export const queryListByTypeCodes = (data?: object) => {
  return http.request<ResultTable>("post", `/account/api/v1/publish/dictItem/queryListByTypeCodes`, {
    data
  });
};

//废液 查询列表
export const getqueryListPage = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/generalWaste/liquid/queryListPage`, {
    data
  });
};

//废液 新增
export const liquidAdd = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/generalWaste/liquid/add`, {
    data
  });
};

//废液 更新
export const liquidUpdate = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/generalWaste/liquid/update`, {
    data
  });
};

//废液 删除
export const liquidDelete = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/generalWaste/liquid/delete`, {
    data
  });
};

//废液 删除文件接口
export const liquidFileDelete = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/generalWaste/liquid/file/delete`, {
    data
  });
};

//废液 详情
export const liquidqueryDetail = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/generalWaste/liquid/queryDetail`, {
    data
  });
};
//废液 导出
export const liquidExport = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/generalWaste/liquid/export`, {
    data
  });
};

//危险废液委外及台账 查询列表
export const wflqueryListPage = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteOutDetail/solid/queryListPage`, {
    data
  });
};

//危险废液委外及台账 查询列表
export const wflqueryListPage1 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteOutDetail/liquid/queryListPage`, {
    data
  });
};

//危险废液委外及台账 批量下载
export const wflexport = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteOutDetail/liquid/export`, {
    data
  });
};

//危险废弃物入库 查询列表
export const queryListPagepush = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteIn/queryListPage`, {
    data
  });
};

//危险废弃物入库 详情
export const queryDetailpush = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteIn/queryDetail`, {
    data
  });
};

//危险废弃物入库 新增
export const addpush = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteIn/add`, {
    data
  });
};

//危险废弃物入库 删除
export const deletepush = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteIn/delete`, {
    data
  });
};

//危险废弃物入库 更新
export const updatepush = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteIn/update`, {
    data
  });
};

//危险废弃物出库 查询列表
export const queryListPagepull = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteOut/queryListPage`, {
    data
  });
};

//危险废弃物出库 新增
export const addpull = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteOut/add`, {
    data
  });
};

//危险废弃物出库  删除
export const deletepull = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteOut/delete`, {
    data
  });
};

//危险废弃物出库  详情
export const queryDetailpull = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteOut/queryDetail`, {
    data
  });
};

//危险废弃物出库  更新
export const updatepull = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteOut/update`, {
    data
  });
};

//危险废弃物出库 批量出库
export const queryBatchOutInfopull = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteOut/queryBatchOutInfo`, {
    data
  });
};

//危险废弃物入库 出库新增查询查询列表
export const queryListPageForOutbound = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/hazardWasteIn/queryListPageForOutbound`, {
    data
  });
};

//根据typeCode和itemValue查询子项
export const queryChildByTypeCodeAndItemValue1 = (data?: object, cb?: (err: any) => any) => {
  return http.request<SelectDataType>(
    "post",
    `/account/api/v1/publish/dictItem/queryChildByTypeCodeAndItemValue`,
    {
      data
    },
    null,
    cb
  );
};

//废液 查询列表
export const getqueryListPage1 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/generalWaste/solid/queryListPage`, {
    data
  });
};

//废液 新增
export const solidAdd = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/generalWaste/solid/add`, {
    data
  });
};

//废液 更新
export const solidUpdate = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/generalWaste/solid/update`, {
    data
  });
};

//废液 删除
export const solidDelete = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/generalWaste/solid/delete`, {
    data
  });
};

//废液 删除文件接口
export const solidFileDelete = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/generalWaste/solid/file/delete`, {
    data
  });
};

//废液 详情
export const solidqueryDetail = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/generalWaste/solid/queryDetail`, {
    data
  });
};
//废液 导出
export const solidExport = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/generalWaste/solid/export`, {
    data
  });
};

// 空调水质检测 查询列表
export const waterTestList = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/waterQuality/queryReport`, {
    data
  });
};

// 空调水质检测 导入报告
export const importReport = (data?: object) => {
  return http.request<ResultTable>(
    "post",
    `/operation/api/v1/machine/detect/waterQuality/importReport`,
    {
      data
    },
    { headers: { noLoading: true, "Content-Type": "multipart/form-data" } }
  );
};

// 空调水质检测 导入历史
export const queryImportHistoryListPage = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/waterQuality/queryImportHistoryListPage`, {
    data
  });
};

// 空调水质检测 查询概览
export const querySummary = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/waterQuality/querySummary`, {
    data
  });
};
//删除水质检测记录
export const deleteReport = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/waterQuality/deleteReport`, {
    data
  });
};
// 洁净室环境检测-AMC 查询列表
export const wasteWaterqueryListPage0 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/amc/queryListPage`, {
    data
  });
};

// 洁净室环境检测-AMC 获取检测项目
export const wasteWatergetTestItem0 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/amc/getTestItem`, {
    data
  });
};

// 洁净室环境检测-AMC 新增
export const wasteWateradd0 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/amc/add`, {
    data
  });
};

// 洁净室环境检测-AMC 更新
export const wasteWaterupdate0 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/amc/update`, {
    data
  });
};

// 洁净室环境检测-AMC 详情
export const wasteWaterqueryDetail0 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/amc/queryDetail`, {
    data
  });
};

// 洁净室环境检测-AMC 删除
export const wasteWaterdelete0 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/amc/delete`, {
    data
  });
};

// 洁净室环境检测-VOC 查询列表
export const wasteWaterqueryListPage1 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/voc/queryListPage`, {
    data
  });
};

// 洁净室环境检测-VOC 获取检测项目
export const wasteWatergetTestItem1 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/voc/getTestItem`, {
    data
  });
};

// 洁净室环境检测-VOC 新增
export const wasteWateradd1 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/voc/add`, {
    data
  });
};

// 洁净室环境检测-VOC 更新
export const wasteWaterupdate1 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/voc/update`, {
    data
  });
};

// 洁净室环境检测-VOC 详情
export const wasteWaterqueryDetail1 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/voc/queryDetail`, {
    data
  });
};

// 洁净室环境检测-VOC 删除
export const wasteWaterdelete1 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/voc/delete`, {
    data
  });
};

// 洁净室环境检测-Particle 查询列表
export const wasteWaterqueryListPage11 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/particle/queryListPage`, {
    data
  });
};

// 洁净室环境检测-Particle 获取检测项目
export const wasteWatergetTestItem11 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/particle/getTestItem`, {
    data
  });
};

// 洁净室环境检测-Particle 新增
export const wasteWateradd11 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/particle/add`, {
    data
  });
};

// 洁净室环境检测-Particle 更新
export const wasteWaterupdate11 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/particle/update`, {
    data
  });
};

// 洁净室环境检测-Particle 详情
export const wasteWaterqueryDetail11 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/particle/queryDetail`, {
    data
  });
};

// 洁净室环境检测-Particle 删除
export const wasteWaterdelete11 = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/detect/particle/delete`, {
    data
  });
};

// 获取天气读数
export const queryWeatherData = (data?: object | undefined) =>
  http.request<AxiosResultDefault>(
    "post",
    `/operation/api/v1/machine/cr/visual/outdoorWeather?diffHours=${data.diffHours}`,
    {},
    { headers: { noLoading: true } }
  );

// 获取洁净室所有区域
export const getFabZone = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/machine/cr/visual/getFabZone`, { data }, { headers: { noLoading: true } });

// 获取洁净室所有区域列表
export const getReadersInZone = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/machine/cr/visual/getReadersInZone`, { data }, { headers: { noLoading: true } });

// 获取洁净室所有区域下点位列表
export const getReadersInZoneByType = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/machine/cr/visual/getReadersInZoneByType`, { data }, { headers: { noLoading: true } });

// 根据点位查询实时数据最新值
export const getPointNewValue = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/data/api/v1/dataQuery/queryPanelValues`, { data }, { headers: { noLoading: true } });

// 查询点位值曲线
export const getPointsCurve = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/common/queryPointCurve`, { data }, { headers: { noLoading: true } });

// 查询区域报警数
export const queryAreaWornings = (data?: object) => {
  return http.request<ResultTable>("post", `/sharing/api/v1/alarm/business/query`, {
    data
  });
};

// 批注
export const addRemake = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/spcNote/add`, { data }, { headers: { noLoading: true } });

// 批注历史
export const remakeHistory = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/spcNote/queryList`, { data }, { headers: { noLoading: true } });

// FFU台账列表
export const getFFUList = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/ffuList`, {
    data
  });
};

// FFU台账列表
export const getFFUDetail = (data?: object) => {
  return http.request<ResultTable>("post", `/pms/publish/replaceConsumable`, {
    data
  });
};

// FFU台账新增
export const ffuAdd = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/ffuAdd`, {
    data
  });
};

// FFU台账删除
export const ffuDelete = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/ffuDel`, {
    data
  });
};

// 平台概览 （机械课）
export const queryMachineOverview = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/machine/queryChart`, { data }, { headers: { noLoading: true } });

// 页面配置 （机械课-加药）
export const queryPabgeConfig = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/machine/dosing/queryPageConfig`, { data }, { headers: { noLoading: true } });

// 药剂累计用量（机械课-加药）
export const queryTotalStatistics = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/machine/dosing/queryTotalStatistics`, { data }, { headers: { noLoading: true } });

// 加药 查询列表
export const addDrugList = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/dosing/queryReport`, {
    data
  });
};

// 加药 导入报告
export const importAddDrug = (data?: object) => {
  return http.request<ResultTable>(
    "post",
    `/operation/api/v1/machine/dosing/importReport`,
    {
      data
    },
    { headers: { noLoading: true, "Content-Type": "multipart/form-data" } }
  );
};

// 加药 导入历史
export const queryImportHistory = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/dosing/queryImportHistoryListPage`, {
    data
  });
};

// AMC 导入报告
export const importAddAmc = (data?: object) => {
  return http.request<ResultTable>(
    "post",
    `/operation/api/v1/machine/dosing/importReport`,
    {
      data
    },
    { headers: { noLoading: true, "Content-Type": "multipart/form-data" } }
  );
};

// AMC 导入报告
export const importAddAmcReport = (data?: object) => {
  return http.request<ResultTable>(
    "post",
    `/operation/api/v1/machine/detect/amc/importReport`,
    {
      data
    },
    { headers: { noLoading: true, "Content-Type": "multipart/form-data" } }
  );
};

// AMC 导入历史
export const queryImportHistoryList = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/dosing/queryImportHistoryListPage`, {
    data
  });
};

// 获取工单执行人列表
export const getTeamList = (data?: object) => {
  return http.request<ResultTable>("post", `/pms/notification/group/lists`, {
    data
  });
};

// FFU布置率
export const getLayoutTable = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/machine/listFilterDistrubtion`, {
    data
  });
};

// FFU完整完整布置图
export const getAllFFU = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/machine/ffuAll`, { data }, { headers: { noLoading: true } });

// 厂务各科耗材更换任务创建
export const createAndReplace = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/pms/publish/replaceConsumable`, { data }, { headers: { noLoading: true } });

// 获取洁净间指定指标的Q测值与在线值的对比柱状图数据
export const getBarChartsData = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/machine/cr/visual/getDetectedValuesInPair`, { data }, { headers: { noLoading: true } });

// 获取洁净间指定指标的Q测值与在线值的对比柱状图数据
export const getGroupList = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/pms/notification/group/list`, { data }, { headers: { noLoading: true } });

// 耗材-创建工单
export const createWork = (data?: object) => {
  return http.request<ResultTable>("post", `/operation/api/v1/consumable/createWorkOrder`, {
    data
  });
};

// 化滤生命周期统计表
export const queryCountFilterUsage = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/operation/consumable/countFilterUsage`, { data }, { headers: { noLoading: true } });

//
export const queryCorrelationFactorS = (data?: object | undefined) =>
  http.request<AxiosResultDefault>(
    "post",
    `/operation/api/v1/machine/correlationFactors/queryCorrelationFactorS`,
    { data },
    { headers: { noLoading: true } }
  );

// 化滤寿命预测
export const calculateFilterLifespan = (area?: String | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/machine/calculateFilterLifespan/${area}`, null, { headers: { noLoading: true } });
// 水质检测热力图查询
export const queryTwoCorrelationFactorSAndResult = (data?: object) => {
  return http.request<ResultTable>(
    "post",
    `/operation/api/v1/machine/correlationFactors/queryTwoCorrelationFactorSAndResult`,
    {
      data
    },
    { headers: { noLoading: true } }
  );
};
// 化滤寿命预测
export const calculateFilterLifespanNew = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/machine/calculateFilterLifespanNew`, { data }, { headers: { noLoading: true } });

// 化滤寿命预测-new
export const ffuLifespan = (data?: object | undefined) =>
  http.request<AxiosResultDefault>("post", `/operation/api/v1/operation/consumable/queryFFU`, { data }, { headers: { noLoading: true } });

// 水质检测折线图
export const queryAl = (data?: object) => {
  const dataParam = { reportStart: data.reportStart, reportEnd: data.reportEnd, subsystem: data.subsystem };
  return http.request<ResultTable>(
    "post",
    `/operation/api/v1/machine/detect/waterQuality/queryAI/${data.indicator}`,
    {
      data: dataParam
    },
    { headers: { noLoading: true } }
  );
};
// 删除水质检测记录
export const deleteWaterReport = (data?: object) => {
  return http.request<ResultTable>(
    "post",
    `/operation/api/v1/machine/detect/waterQuality/deleteReport`,
    {
      data
    },
    { headers: { noLoading: true } }
  );
};

export const queryMeasureByCodes = (data?: object) => {
  return http.request<ResultTable>(
    "post",
    `/account/api/v1/measurev2/queryByMeasureCodes`,
    {
      data
    },
    { headers: { noLoading: true } }
  );
};

// EXH 预测接口
export const queryTimePredicatedEXHData = (data?: object) => {
  return http.request<ResultTable>(
    "post",
    `/operation/api/v1/operation/algorithm/queryTimePredicatedEXHData`,
    {
      data
    },
    { headers: { noLoading: true } }
  );
};

// EXH 预测接口
export const queryGasFuture = (data?: object) => {
  return http.request(
    "post",
    `/operation/api/v1/operation/algorithm/queryGasFuture`,
    {
      data
    },
    { headers: { noLoading: true } }
  );
};
// VOC废气在线监测
export const queryExhauseMeterList = (data?: object) => {
  return http.request(
    "post",
    `/operation/api/v1/machine/detect/exhause/meterRecord`,
    {
      data
    },
    { headers: { noLoading: true } }
  );
};
